<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<c:set var="uri" value="${pageContext.request.contextPath}" />
    <script type="text/javascript">
    var uri='${uri}';
        </script>
        <meta charset="UTF-8">
        <title>修改-商品</title>
        <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
        <!-- bootstrap 3.0.2 -->
        <link href="${pageContext.request.contextPath}/static/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
            <!-- font Awesome -->
            <link href="${pageContext.request.contextPath}/static/bootstrap/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
                <!-- Ionicons -->
                <link href="${pageContext.request.contextPath}/static/bootstrap/css/ionicons.min.css" rel="stylesheet" type="text/css" />
                    <!-- Theme style -->
                    <link href="${pageContext.request.contextPath}/static/bootstrap/css/ALTE.css" rel="stylesheet" type="text/css" />
                        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
                        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
                        <!--[if lt IE 9]>
                        <script src="${pageContext.request.contextPath}/static/bootstrap/html5shiv.js"></script>
                            <script src="${pageContext.request.contextPath}/static/bootstrap/respond.min.js"></script>
                                <![endif]-->
                                
                  		 	     <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/common/webupload/webuploader.css">
                  		 	
                                <style type="text/css">
                                .btnStyle{
                                    margin-left:8px;
                                    margin-top:8px
                                }
                                .loadingModel {
                                    position: absolute;
                                    top: 0;
                                    left: 0;
                                    background-color: rgba(9, 9, 9, 0.63);
                                    width: 100%;
                                    height: 100%;
                                    z-index: 1000;
                                }
                                .loading-content {
                                    width: 50%;
                                    text-align: center;
                                    background: #ffffff;
                                    border-radius: 6px;
                                    line-height: 30px;
                                    z-index: 10001;
                                }
                                </style>
                                </head>
                                <body class="skin-blue">
                                <div id="loadingDiv"></div>
                                <div id="imgModal"></div>
                                <div class="wrapper row-offcanvas row-offcanvas-left">
                                <!-- Right side column. Contains the navbar and content of the page -->
                                <!-- Main content -->
                                <section class="content">
                                <div class="row">
                                <!-- left column -->
                                <div class="col-md-12">
                                <!-- general form elements -->
                                <div class="box box-primary">
                                <div class="box-header">
                                <h3 class="box-title">修改-商品</h3>
                                </div><!-- /.box-header -->
                                <!-- form start -->
                                <div class="box-body">
                                
             <div class="row" style="margin-left:20px;">
                     <div class="col-md-2"><label>商品名</label></div>
                      <div class="col-md-8">
                           <div class="form-group">
                              
                  	<input type="text"   style="width:500px;display:inline"  placeholder="请输入商品名" id="goodsName" value="${data.goodsName}" class="layui-input">
             
                             </div>
                      </div>
             </div>
            
             <div class="row" style="margin-left:20px;">
                     <div class="col-md-2"><label>商品大图</label></div>
                      <div class="col-md-8">
                           <div class="form-group">
                              
                  		 	   <div class="imgUpload" tip="请商品大图，数量不超过1" red-tip=""   upload-num="1" init-val="${data.goodsImg}" upload-type="1" id="goodsImg"></div>
                  		 
                             </div>
                      </div>
             </div>
            
             <div class="row" style="margin-left:20px;">
                     <div class="col-md-2"><label>商品价格</label></div>
                      <div class="col-md-8">
                           <div class="form-group">
                              
                  	<input type="text"   style="width:500px;display:inline"  placeholder="请输入商品价格" id="price" value="${data.price}" class="layui-input">
             
                             </div>
                      </div>
             </div>
            
             <div class="row" style="margin-left:20px;">
                     <div class="col-md-2"><label>库存</label></div>
                      <div class="col-md-8">
                           <div class="form-group">
                              
                  	<input type="text"   style="width:500px;display:inline"  placeholder="请输入库存" id="stockNum" value="${data.stockNum}" class="layui-input">
             
                             </div>
                      </div>
             </div>
            
             
                                </div><!-- /.box-body -->
                                <div class="box-footer">
                                <button type="button" onclick="submitData();"  class="btn btn-primary">提交并保存</button>
                                <button type="button" onclick="javascript:history.back(-1);" class="btn btn-default">返回</button>
                                </div>
                                </div><!-- /.box -->
                                </div><!--/.col (left) -->
                                </div>   <!-- /.row -->
                                </section><!-- /.content -->
                                </aside><!-- /.right-side -->
                                </div><!-- ./wrapper -->
                                <script type="text/javascript" src="${pageContext.request.contextPath}/static/common/jquery-1.11.1.min.js"></script>
                                    <!-- Bootstrap -->
                                    <script src="${pageContext.request.contextPath}/static/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
                                        <!-- AdminLTE App -->
                                        <script src="${pageContext.request.contextPath}/static/bootstrap/js/AdminLTE/app.js" type="text/javascript"></script>
                                            <script type="text/javascript" src="${pageContext.request.contextPath}/static/common/utils/listutils.js?v=6104"></script>
                                                     
                  		 	     <script type="text/javascript" src="${pageContext.request.contextPath}/static/common/webupload/webuploader.js"></script>
                                 <script type="text/javascript" src="${pageContext.request.contextPath}/static/common/webupload/upload.js"></script>
                  		 	
                                                <script type="text/javascript">
                                                   $(function(){
                                            
                  		 	    createFileUpload('${pageContext.request.contextPath}');
                  		 	
                                        })
                                        
                                        
                                        function submitData(){
											var goodsName=$("#goodsName").val();
var goodsImg=getUploadFileStr('goodsImg');;
var price=$("#price").val();
var stockNum=$("#stockNum").val();
                                            
                                            $.ajax({
                                                type: 'post',
                                                url: 'AdminGoodsInfoServlet?method=updateSubmit',
                                                    data:{
                                                      "goodsName":goodsName,
"goodsImg":goodsImg,
"price":price,
"stockNum":stockNum,
"id":'${data.id}'

                                                    },
                                                    success: function(result) {
                                                    	result=$.parseJSON(result);
                                                        if(result.code == 0){
                                                            alert(result.msg);
                                                            }else{
                                                                alert(result.msg);
                                                                self.location=document.referrer;
                                                            }
                                                        }
                                                    });
                                                }
                                                        </script>
                                                        </body>
                                                        </html>
